import SugonRequest from '@/utils/request/request'
import { API_BASE_URL, TIME_OUT } from '@/utils/request/config'

const request = new SugonRequest({
  baseURL: API_BASE_URL,
  timeout: TIME_OUT,
  interceptorHooks: {
    requestInterceptor: (config) => {
      //  token验证
      //   if (token) {
      //     config.headers.Authorization = `Bearer ${token}`
      //   }
      return config
    },
    requestInterceptorCatch: (err) => {
      return err
    },
    responseInterceptor: (res) => {
      return res.data
    },
    responseInterceptorCatch: (err) => {
      return err
    }
  }
})

export default request
